from search import *
from util import Index, InvertedIndex
from process import *


if __name__ == '__main__':
    '''
    爬虫->分词->index->search
    '''
    file_list = get_file_list()
    index, inverse = build_index(file_list)
    while True:
        s = input("input the word:\t")
        if s == "/quit":
            break
        elif s == "/index":
            print(index.map)
            continue
        elif s == "/inverse":
            print(inverse.map)
            continue
        rs = search(s, inverse, index)
    gc(file_list)
